<template>
  <div>
    <Result
      v-if="success"
      type="success"
      isSuccess="success"
      title="提交成功"
      description="我们将在1-2个工作日内完成审核，您可以通过“商户审核查询”查询进度。"
      class="result"
    ></Result>
    <div v-if="success" style="text-align:center;">
      <a-button type="primary" @click="closePage">关闭页面</a-button>
      <a-button type="primary" @click="addTerminal">添加终端</a-button>
    </div>

    <Result v-if="!success" title="提交失败" class="result" description reason="法人姓名、身份证不匹配"></Result>
    <div v-if="!success" style="text-align:center;">
      <!-- <a-button @click="onPrev(10)">上一步</a-button> -->
      <a-button type="primary" @click="Rewrite">重新填写</a-button>
    </div>
  </div>
</template>
<script>
import Result from "@/components/result/Result";
import { message } from "ant-design-vue";
import api from "@/common/api";
import { error } from "util";
import { fail } from "assert";
export default {
  data() {
    return {
      memberNo: "",
      success: true
    };
  },
  components: {
    Result
  },
  created() {},
  mounted() {
    this.memberNo = sessionStorage.getItem("memberNo");
    console.log(this.$route.query.success);
    if (this.$route.query.success) {
      this.success = true;
    } else {
      this.success = false;
    }
  },
  methods: {
    onPrev(step) {
      var st = step - 1;
      this.$router.push("/OrgRegister/step" + st);
    },
    doNext(step) {
      var st = step + 1;
      this.$router.push("/OrgRegister/step" + st);
    },
    Rewrite() {
      this.$router.push({ path: "/OrgRegister/step4" });
    },
    closePage() {
      this.$router.push("/OrgRegister/orgAuditQuery");
      // window.opener = null;
      // window.open("about:blank", "_top").close()
    },
    CloseWebPage() {
      if (navigator.userAgent.indexOf("MSIE") > 0) {
        if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
          window.opener = null;
          window.close();
        } else {
          window.open("", "_top");
          window.top.close();
        }
      } else if (navigator.userAgent.indexOf("Firefox") > 0) {
        window.location.href = "about:blank "; //火狐默认状态非window.open的页面window.close是无效的
        //window.history.go(-2);
      } else {
        window.opener = null;
        window.open("", "_self", "");
        window.close();
      }
    },
    addTerminal() {
      let memberNo =
        sessionStorage.getItem("orgAMemberNo") ||
        sessionStorage.getItem("orgBMemberNo");
      this.$router.push({
        path: "/newTerminal",
        query: { memberNo: memberNo }
      });
    }
  }
};
</script>